<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="/bishedabian/CLY/Public/shop/css/style.css" /> 
<link rel="shortcut icon" href="/bishedabian/CLY/Public/images/ico.ico">
<script type="text/javascript" src="/bishedabian/CLY/Public/shop/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/bishedabian/CLY/Public/shop/js/menu.js"></script>    
<script type="text/javascript" src="/bishedabian/CLY/Public/shop/js/select.js"></script>

<!-- <meta http-equiv="refresh" content="300">  -->
<title>美食美客商户中心</title>
</head>
<body>  
<!--Begin Header Begin-->
<div class="soubg">
	<div class="sou">
    	
        <span class="fr">
        	<span class="fl">
                你好，<?php echo ($_SESSION['shopuser']['username']); ?> 

                <a href="/bishedabian/CLY/index.php/Home/Public/doSLogout" mon="element=login">退出</a>&nbsp;
                  |&nbsp;<a href="#">我的订单</a>&nbsp;|</span>
        	<span class="ss">
            	<!-- <div class="ss_list">
                	<a href="#">收藏夹</a>
                    <div class="ss_list_bg">
                    	<div class="s_city_t"></div>
                        <div class="ss_list_c">
                        	<ul>
                            	<li><a href="#">我的收藏夹</a></li>
                                <li><a href="#">我的收藏夹</a></li>
                            </ul>
                        </div>
                    </div>     
                </div> -->
                <div class="ss_list">
                	<a href="#">客户服务</a>
                    <div class="ss_list_bg">
                    	<div class="s_city_t"></div>
                        <div class="ss_list_c">
                        	<ul>
                            	<li><a href="#">客户服务</a></li>
                                <li><a href="#">客户服务</a></li>
                                <li><a href="#">客户服务</a></li>
                            </ul>
                        </div>
                    </div>    
                </div>
                <div class="ss_list">
                	<a href="#">网站导航</a>
                    <div class="ss_list_bg">
                    	<div class="s_city_t"></div>
                        <div class="ss_list_c">
                        	<ul>
                            	<li><a href="#">网站导航</a></li>
                                <li><a href="#">网站导航</a></li>
                            </ul>
                        </div>
                    </div>    
                </div>
            </span>
            
        </span>
    </div>
</div> 
<div class="m_top_bg" style="background-color:#FF5C89">
    <div class="top" >
        <div class="m_logo"><img src="/bishedabian/CLY/Public/shop/images/logo.png"/></div>
        <div class="m_search">
            <form>
                <input type="text" value="" class="m_ipt" />
                <input type="submit" value="搜索" class="m_btn" />
            </form>                      
        </div>
    </div>
</div>
<!--End Header End--> 
<div class="i_bg bg_color">
    <!--Begin 用户中心 Begin -->
	<div class="m_content">
   		<div class="m_left">
            <div class="left_m">
            	<div class="left_n" style="background-color:#FF5C89" onclick="doshow(1)">菜单管理</div>
                <ul id="u1">
                	<li><a href="/bishedabian/CLY/index.php/Home/Seller/showMenu">查看菜单</a></li>
                    <li><a href="/bishedabian/CLY/index.php/Home/Seller/addMenu">添加菜单</a></li>
                </ul>
            </div>
            <div class="left_m">
            	<div class="left_n" style="background-color:#FF5C89" onclick="doshow(2)">店铺管理</div>
                <ul id="u2">
                	<li><a href="/bishedabian/CLY/index.php/Home/Seller/showMember">本店会员</a></li> 
                    <li><a href="/bishedabian/CLY/index.php/Home/Seller/showComment">所有评价</a></li>    
                    <li><a href="/bishedabian/CLY/index.php/Home/Seller/showOrder">本店订单</a></li>  
                </ul>
            </div>
        
        </div>
		<div class="m_right">
            
        <div class="mem_t">菜单信息</div>
        <table border="0" class="acc_tab" style="width:870px;" cellspacing="0" cellpadding="0">
               <thead>
                  <tr>
                    <th>菜品图</th>
                    <th >ID</th>                     
                    <th>菜名</th>
                    <th>单价</th>                   
                    <th>已售出</th>
                    <th>所属分类</th>                    
                    <th>状态</th>
                    <th>添加时间</th>
                    <th>操作</th>
                  </tr>
              </thead>
              <tbody>
                <?php if(is_array($list)): foreach($list as $key=>$me): ?><tr >
                     <td><img src="/bishedabian/CLY/Public/Uploads/s_<?php echo ($me["menu_pic"]); ?>"></td>
                    <td><?php echo ($me["id"]); ?></td>
                    <td><?php echo ($me["menu"]); ?></td>
                    <td>￥<?php echo ($me["price"]); ?></td>                   
                    <td><?php echo ($me["num"]); ?> 份</td>
                    <td><?php echo ($me["label_id"]); ?></td>
                    <td id="change<?php echo ($me["id"]); ?>"><?php if($me["state"] == 1 ): ?>在售<?php else: ?>已下架<?php endif; ?></td>
                    <td><?php echo (date("Y-m-d",$me["addtime"])); ?></td>
                    <td id="button<?php echo ($me["id"]); ?>">    
                    <button onclick="doDel(this,<?php echo ($me["id"]); ?>)" class="btn btn-xs btn-danger" title="删除">删除</button>                 
                    <?php if($me["state"] == 1 ): ?><!-- <button onclick="edit()" class="btn btn-xs btn-danger" title="编辑">编辑</button>  -->
                                         
                      <button onclick="off(<?php echo ($me["id"]); ?>,this);" class="btn btn-xs btn-danger" title="点击上架">下架</button>
                    <?php else: ?>
                      <button onclick="on(<?php echo ($me["id"]); ?>,this);" class="btn btn-xs btn-primary" title="点击下架">上架</button><?php endif; ?>

                    </td>
                  </tr><?php endforeach; endif; ?>
              </tbody>
         </table>
               
         

        </div>
    </div>
	<!--End 用户中心 End--> 
    <!--Begin Footer Begin -->
    <div class="b_nav">
    	<dl>                                                                                            
        	<dt><a href="#">新手上路</a></dt>
            <dd><a href="#">售后流程</a></dd>
            <dd><a href="#">购物流程</a></dd>
            <dd><a href="#">订购方式</a></dd>
            <dd><a href="#">隐私声明</a></dd>
            <dd><a href="#">推荐分享说明</a></dd>
        </dl>
        <dl>
        	<dt><a href="#">配送与支付</a></dt>
            <dd><a href="#">货到付款区域</a></dd>
            <dd><a href="#">配送支付查询</a></dd>
            <dd><a href="#">支付方式说明</a></dd>
        </dl>
        <dl>
        	<dt><a href="#">会员中心</a></dt>
            <dd><a href="#">资金管理</a></dd>
            <dd><a href="#">我的收藏</a></dd>
            <dd><a href="#">我的订单</a></dd>
        </dl>
        <dl>
        	<dt><a href="#">服务保证</a></dt>
            <dd><a href="#">退换货原则</a></dd>
            <dd><a href="#">售后服务保证</a></dd>
            <dd><a href="#">产品质量保证</a></dd>
        </dl>
        <dl>
        	<dt><a href="#">联系我们</a></dt>
            <dd><a href="#">网站故障报告</a></dd>
            <dd><a href="#">购物咨询</a></dd>
            <dd><a href="#">投诉与建议</a></dd>
        </dl>
        <div class="b_tel_bg">
        	<a href="#" class="b_sh1">新浪微博</a>            
        	<a href="#" class="b_sh2">腾讯微博</a>
            <p>
            服务热线：<br />
            <span style="color:#FF5C89">183-000-3282</span>
            </p>
        </div>
        <div class="b_er">
            <div class="b_er_c"><img src="/bishedabian/CLY/Public/shop/images/weixin.jpg" width="118" height="118" /></div>
            <img src="/bishedabian/CLY/Public/shop/images/ss.png" />
        </div>
    </div>    
    <div class="btmbg">
		<div class="btm">
        	备案/许可证编号：晋ICP备12009302号-1-www.msmk.com   Copyright © 2016-2017 美食美客 All Rights Reserved. 复制必究 , Technical Support: msmk Group <br />
            <img src="/bishedabian/CLY/Public/shop/images/b_1.gif" width="98" height="33" /><img src="/bishedabian/CLY/Public/shop/images/b_2.gif" width="98" height="33" /><img src="/bishedabian/CLY/Public/shop/images/b_3.gif" width="98" height="33" /><img src="/bishedabian/CLY/Public/shop/images/b_4.gif" width="98" height="33" /><img src="/bishedabian/CLY/Public/shop/images/b_5.gif" width="98" height="33" /><img src="/bishedabian/CLY/Public/shop/images/b_6.gif" width="98" height="33" />
        </div>    	
    </div>
    <!--End Footer End -->    
</div>

<script>
	function doshow(d){
		var ul = document.getElementById("u"+d);
		if(ul.style.display == "none"){
			ul.style.display = "block";
		}else{
			ul.style.display = "none";
		}
	}
	</script>
    <script src="/bishedabian/CLY/Public/Admin/plugins/jQuery/jQuery-2.1.4.min.js"></script>
    
   <script type="text/javascript">
      function doDel(obj,id){
            // Modal.confirm({msg:'确定要删除吗？'}).on(function(e){
                // if (e) {
                    $.ajax({
                      type:"get",
                      url:"/bishedabian/CLY/index.php/Home/Seller/delMenu",
                      data:"id="+id,
                      dataType:"json",
                      success:function (data){
                        if(data.b){
                          $(obj).parents("tr").remove();
                        }
                      },
                      error:function () {
                          
                      }
                    });
                // }
            // })
        }
        //执行下架
    function off(id){
      // Modal.confirm({msg:"确定下架吗？"}).on(function(e){
      //   if(e){
          $.ajax({
            type:'GET',             //请求方式GET
            url :'/bishedabian/CLY/index.php/Home/Seller/off',           //ajax请求地址
            data:'id='+id, //请求传递的参数
            dataType:'json',        //预期服务器返回的数据类型
            async : true,           //是否异步
            success: function(res){
              //alert(res.id);
              if(res != "null"){
                $("#button"+res.id).html("<button onclick='doDel(this,"+res.id+")' class='btn btn-xs btn-danger' title='删除'>删除</button>   <button onclick='on("+res.id+");' class='btn btn-xs btn-primary' title='点击下架'>上架</button>");
                $("#change"+res.id).html("已下架");
              }
            },  //ajax成功后的回调函数
          });
      //   }
      // }); 
    }
    //重新上架
    function on(id){
      // Modal.confirm({msg:"确定重新上架吗？"}).on(function(e){
      //   if(e){
          $.ajax({
            type:'GET',             //请求方式GET
            url :'/bishedabian/CLY/index.php/Home/Seller/on',           //ajax请求地址
            data:'id='+id, //请求传递的参数
            dataType:'json',        //预期服务器返回的数据类型
            async : true,           //是否异步
            success: function(res){
              //alert(res.id);
              if(res != "null"){
                $("#button"+res.id).html("<button onclick='doDel(this,"+res.id+")' class='btn btn-xs btn-danger' title='删除'>删除</button> <button onclick='off("+res.id+");' class='btn btn-xs btn-danger' title='点击上架'>下架</button>");
                $("#change"+res.id).html("在售");
              }
            },  //ajax成功后的回调函数
          });
      //   }
      // });
    }
   </script>

</body>
</html>